{% if title == "Início" %}
  {% set title = t("Início") %}
{% elseif title == "Tag" %}
  {% set title = "Tag: " + tag %}
{% endif %}



{% extends 'layouts/layout.html' %}

{% block opengraph %}
<meta property="og:image" content="/sm-share3.jpg" />
<meta property="og:type" content="blog" />
<meta property="og:title" content="Libreflix - {{t('Sua plataforma de streaming livre')}}" />
<meta property="og:description" content="Libreflix é uma plataforma de streaming aberta e colaborativa que reúne produções audiovisuais independentes, de livre exibição e que fazem pensar." />
<meta property="og:url" content="https://libreflix.org" />
<meta property="og:site_name" content="Libreflix" />

<!-- twitter metatags-->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Libreflix - {{t('Sua plataforma de streaming livre')}}">
<meta name="twitter:description" content="Libreflix é uma plataforma de streaming aberta e colaborativa que reúne produções audiovisuais independentes, de livre exibição e que fazem pensar.">
<meta name="twitter:image" content="https://libreflix.org/sm-share3.jpg">
{% endblock %}

{% block body %}
<div class="container-fluid">
  {% if messages.success %}
  <div role="alert" class="alert alert-success">
    {% for success in messages.success %}
    <div>{{ success.msg }}</div>
    {% endfor %}
  </div>
  {% endif %}
  {% if messages.error %}
  <div role="alert" class="alert alert-danger">
    {% for error in messages.error %}
    <div>{{ error.msg }}</div>
    {% endfor %}
  </div>
  {% endif %}
  {% if messages.info %}
  <div role="alert" class="alert alert-info">
    {% for info in messages.info %}
    <div>{{ info.msg }}</div>
    {% endfor %}
  </div>
  {% endif %}

</div>



{% macro printWatches(title, query) -%}

{% set watch = query %}

<h3>{{ t(title) }}</h3>
<div class="grid">
  <p> {{ alltags }} </p>
  <ul class="entries">
    {% for w in watch %}
    {% if w.featured %}

    <li class="col-md-3">
      <a role="button" data-toggle="modal" style="border-bottom: 0px solid;"  data-toggle="modal" data-target="#assistir{{ w.permalink }}">
      <div class="cover">
          <img src="{% if w.thumb480 %}{{ w.thumb480 }}?resize=480,270&crop=entropy {% elseif w.imgbg %} {{ w.imgbg }}?resize=480,270&crop=entropy{% endif %}" title="{{ w.title }}{% if w.subtitle %} - {{ w.subtitle }}{% endif %} ({{ w.year }})" class="fadeCatalogo" onload="this.style.opacity='1'"/>
        <div class="cover_wrap">
          <div class="cover_info">
            <h3>{{ w.title | truncate(40) }}</h3>
            <h4>
              {{ w.subtitle | truncate(35) }}
              {% if w.subtitle %} </h4> <h4> {%endif%} {{w.year}}
              {% if w.classind  %} &middot; <span class="classind">{{ w.classind }}</span>{% endif %}
              {% if w.duration  %} &middot; <i class="fa fa-clock-o" aria-hidden="true"></i> {{ w.duration }} {% endif %}
            </h4>
          </div>
        </div>
        <!--<h3>{{ w.title }}</h3>-->
      </div>
      </a>

    </li>
    <div class="modal" id="assistir{{ w.permalink }}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel{{ w.permalink }}">
      <div class="modal-dialog" role="document">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fa fa-times-circle exitTimes"></i></button>
            <a href="/i/{{ w.permalink }}"><button type="button" class="splash-play"><img src="/img/play.png" alt="Play"></button></a>
            <!-- <h4 class="modal-title" id="myModalLabel{{ loop.index }}">{{ w.title }} {% if w.subtitle %} - {{ w.subtitle }} {% else %} {% endif %}</h4> -->
            <a href="/i/{{ w.permalink }}"><div class="splash" style="background-image: url('{{ w.imgbg }}');">
            </div></a>
          </div>
          <div class="modal-body">
            <h2> {{ w.title }}</h2>

            <h4>
              {% set list1 = w.crew.director.split(',') %}{% for list in list1 %} {% if loop.first %}{{ list }}{% endif %}{% endfor %}{% if w.crew.director %}, {%endif%} {{w.year}}
              {% if w.classind  %} &middot; <span class="classind">{{ w.classind }}</span>{% endif %}
              {% if w.duration  %} &middot; <i class="fa fa-clock-o" aria-hidden="true"></i> {{ w.duration }} {% endif %}
            </h4>
            <h4></h4>
            <div class="sinopse">{{ w.sinopse | truncate(300)}}</div>
            <h4> Tags: {% set list1 = w.tags.split(',') %}{% for list in list1 %}{% if loop.index0 < 6 %}<a href="/t/{{ list | trim}}"><span class="label label-default">{{ list | trim}}</span></a>{% endif %}{%if (loop.index0 < loop.length-1) or (loop.index0 < 6) %} {%endif%}{% endfor %}</h4>
          </div>
          <div class="modal-footer">
            {% if user.mod or user.adm %}<a href="/edit/{{ w._id }}"><button type="button" class="btn btn-danger"> <i class="fa fa-edit"></i> Editar</button></a>{% endif %}
            <button type="button" class="btn btn-default" data-dismiss="modal"><i class="fa fa-times-circle"></i> {{ t('Fechar') }} </button>
            <a href="/i/{{ w.permalink }}"><button type="button" class="btn btn-success"><i class="fa fa-info-circle"></i> {{ t('Informações') }} </button></a>
            <!-- <a href="/i/{{ w.permalink }}"><button type="button" class="btn btn-success">{{ t('Assistir') }} <i class="fa fa-play-circle"></i></button></a> -->
          </div>
        </div>
      </div>
    </div>
    {% endif %}
    {% endfor %}
  </ul>
</div>
{%- endmacro %}

{% macro printTagCards(tagname) -%}


<a href="/t/{{tagname}}"><div class="tagcard" style="background-image: url('https://vdn.libreflix.org/media/tags/{{tagname}}.jpg');"><p class="tagcard-text">{{ t(tagname) | capitalize}}</p></a></div>

{%- endmacro %}

<section class="work">

  <div class="tagcardgrab">
    <div class="tagcardcontainer">

      {% set tagsArray = [ 'social', 'tech', 'musica', 'sci-fi', 'ativismo', 'veganismo', 'feminismo', 'educação', 'animação', 'comédia', 'religião', 'natureza', 'ocupação'] %}

      <!-- Print Cards -->
      {% for tags in tagsArray %}
      {{ printTagCards(tags) }}
      {% endfor %}


    </div>
  </div>


  <br><br>


  {{ printWatches('Para Assistir Hoje', hot) }}
  {{ printWatches('Obras Recém Chegadas', fresh_all) }}
  {{ printWatches('Em Alta na Libreflix', new_l) }}
  {{ printWatches('Seleção 1º de Maio', diadotrabalhador) }}
  {{ printWatches('Longas Populares', top_l) }}
  {{ printWatches('Curtas Populares', top_c) }}
  {{ printWatches('Especial #DitaduraNuncaMais', ditadura) }}
  {{ printWatches('Séries Populares', top_s) }}
  {{ printWatches('Curtas Recém Chegados', new_c) }}


  <div class="centerBlock">
    <!--<a class="btn" href="#">Ver todo o conteúdo</a>-->
  </div>

</section>

{#
<div class="wrapper">
  <section id="section1">
    <a href="#section3">‹</a>
      <div class="item">
        <img src="https://libreflix.org/media/97dd66f0-43d3-11e8-a1c2-a5f3498bcf2eidioma.jpg?resize=341,192&crop=entropy"/>
      </div>
      <div class="item">
        <img src="https://libreflix.org/media/97dd66f0-43d3-11e8-a1c2-a5f3498bcf2eidioma.jpg?resize=341,192&crop=entropy"/>
      </div>
      <div class="item cover">
        <div class="cover">
            <!-- <img src="{% if w.thumb480 %}{{ w.thumb480 }}?resize=480,270&crop=entropy {% elseif w.imgbg %} {{ w.imgbg }}?resize=480,270&crop=entropy{% endif %}" title="{{ w.title }}{% if w.subtitle %} - {{ w.subtitle }}{% endif %} ({{ w.year }})" class="fadeCatalogo" onload="this.style.opacity='1'"/> -->
          <img class="fadeCatalogo" onload="this.style.opacity='1'" src="https://libreflix.org/media/97dd66f0-43d3-11e8-a1c2-a5f3498bcf2eidioma.jpg?resize=341,192&crop=entropy"/>
          <div class="cover_wrap">
            <div class="cover_info">
              <h3>Idioma Desconhecido</h3>
              <h4>
                {{ w.subtitle | truncate(35) }}
                {% if w.subtitle %} </h4> <h4> {%endif%} {{w.year}}
                {% if w.classind  %} &middot; <span class="classind">{{ w.classind }}</span>{% endif %}
                {% if w.duration  %} &middot; <i class="fa fa-clock-o" aria-hidden="true"></i> {{ w.duration }} {% endif %}
              </h4>
            </div>
          </div>
          <!--<h3>{{ w.title }}</h3>-->
        </div>
      </div>
      <div class="item">
        <img src="https://libreflix.org/media/97dd66f0-43d3-11e8-a1c2-a5f3498bcf2eidioma.jpg?resize=341,192&crop=entropy"/>
      </div>
    <a href="#section2">›</a>
  </section>

  <section id="section2">
    <a href="#section1">‹</a>
      <div class="item">
        <img src="https://libreflix.org/media/97dd66f0-43d3-11e8-a1c2-a5f3498bcf2eidioma.jpg?resize=341,192&crop=entropy"/>
      </div>
      <div class="item">
        <img src="https://libreflix.org/media/97dd66f0-43d3-11e8-a1c2-a5f3498bcf2eidioma.jpg?resize=341,192&crop=entropy"/>
      </div>
      <div class="item">
        <img src="https://libreflix.org/media/97dd66f0-43d3-11e8-a1c2-a5f3498bcf2eidioma.jpg?resize=341,192&crop=entropy"/>
      </div>
      <div class="item">
        <img src="https://libreflix.org/media/97dd66f0-43d3-11e8-a1c2-a5f3498bcf2eidioma.jpg?resize=341,192&crop=entropy"/>
      </div>
      <div class="item">
        <img src="https://libreflix.org/media/97dd66f0-43d3-11e8-a1c2-a5f3498bcf2eidioma.jpg?resize=341,192&crop=entropy"/>
      </div>
    <a href="#section3">›</a>
  </section>

  <section id="section3">
    <a href="#section2">‹</a>
      <div class="item">
        <img src="https://libreflix.org/media/97dd66f0-43d3-11e8-a1c2-a5f3498bcf2eidioma.jpg?resize=341,192&crop=entropy"/>
      </div>
      <div class="item">
        <img src="https://libreflix.org/media/97dd66f0-43d3-11e8-a1c2-a5f3498bcf2eidioma.jpg?resize=341,192&crop=entropy"/>
      </div>
      <div class="item">
        <img src="https://libreflix.org/media/97dd66f0-43d3-11e8-a1c2-a5f3498bcf2eidioma.jpg?resize=341,192&crop=entropy"/>
      </div>
      <div class="item">
        <img src="https://libreflix.org/media/97dd66f0-43d3-11e8-a1c2-a5f3498bcf2eidioma.jpg?resize=341,192&crop=entropy"/>
      </div>
      <div class="item">
        <img src="https://libreflix.org/media/97dd66f0-43d3-11e8-a1c2-a5f3498bcf2eidioma.jpg?resize=341,192&crop=entropy"/>
      </div>
    <a href="#section1">›</a>
  </section>
</div>
#}


{% endblock %}
